package com.hmall.item.config;

import com.hmall.item.interceptor.AuthorizationInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Auth：Yang Zhen
 * @Desc：注册 item-service 的拦截器
 * @Date：2023/4/20 9:03
 */
@Configuration
public class MyMvcConfig implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 添加 item-service 拦截路径，"/**" 为拦截所有路径
        registry.addInterceptor(new AuthorizationInterceptor()).addPathPatterns("/**");
    }

}
